home *** CD-ROM | disk | FTP | other *** search
- /* ---------------------------------------------------------------------- */
- /* Blob Transaction Routines */
- /* ---------------------------------------------------------------------- */
-
-
- # include "BlobMgr.h"
-
-
- /*
- * If the blob has a blob glued to its drag area, dissociate the glued blob.
- * Redraw the drag area. Decrement the use count of the glued blob,
- * undimming it if necessary.
- */
-
- pascal void
- UnglueGlob (BlobHandle b)
- {
- BlobHandle g;
-
- g = (**b).glob;
- if (g != nil) /* skip if don't really have glued blob */
- {
- (**b).glob = nil;
- DrawBlob (b, inDragBlob);
- DecBlobGlue (g); /* dec use count and undim if necessary */
- }
- }
-
-
- pascal void
- UnglueGlobSet (BlobSetHandle bSet)
- {
- BlobLoopProc1 (&UnglueGlob, bSet);
- }
-
-
- /*
- * Glue donor blob d to receptor r. Redraw the drag area of r.
- * Increment the use count of d, dimming it if necessary. If r
- * already has a glue blob, unglue it first (undimming if necessary).
- */
-
- pascal void
- GlueGlob (BlobHandle d, BlobHandle r)
- {
- BlobHandle g;
-
- g = (**r).glob; /* currently glued blob */
- if (g != d) /* ignore if has a glob and it's same */
- {
- if (g != nil) /* if it has a glob already, then */
- DecBlobGlue (g); /* detach and undim if necessary */
- (**r).glob = d;
- IncBlobGlue (d); /* increment use and dim if necessary */
- DrawBlob (r, inDragBlob); /* now have source in drag area - redraw */
- }
- }
-
-
- /*
- * Transfer a glued blob from one blob to another (r1 -> r2). Redraw
- * the drag areas of the blob losing the glued blob, and the one
- * receiving it, but the use count of the transferred blob does not
- * change, so it's not necessary to redraw it.
- */
-
- pascal void
- TransferGlob (BlobHandle r1, BlobHandle r2)
- {
- BlobHandle g1, g2;
-
- if (r1 != r2) /* ignore unless different */
- {
- g1 = BGlob (r1);
- g2 = BGlob (r2);
- if (g1 != nil) /* can't transfer if nothing there! */
- {
- (**r1).glob = nil; /* detach and redraw drag area */
- DrawBlob (r1, inDragBlob);
- if (g2 != nil) /* toss this first if something there */
- DecBlobGlue (g2); /* undim if necessary */
- (**r2).glob = g1;
- DrawBlob (r2, inDragBlob); /* new donor in drag area - redraw */
- }
- }
- }
-
-
- /*
- * Swap the globs glued to r1 and r2. If one of them doesn't actually
- * have a glob, this is equivalent to a transfer.
- */
-
- pascal void
- SwapGlob (BlobHandle r1, BlobHandle r2)
- {
- BlobHandle g1, g2;
-
- if (r1 != r2) /* ignore unless different */
- {
- g1 = (**r1).glob;
- g2 = (**r2).glob;
- if (g1 != g2) /* ignore if both have same glob */
- {
- (**r1).glob = g2;
- (**r2).glob = g1;
- DrawBlob (r1, inDragBlob);
- DrawBlob (r2, inDragBlob);
- }
- }
- }
-
-
- /*
- * Glue the glob that's glued to r1 onto r2 as well. No check
- * is made whether it's really gluable another time or not.
- */
-
- pascal void
- DupGlob (BlobHandle r1, BlobHandle r2)
- {
- BlobHandle g;
-
- if ((g = BGlob (r1)) != nil)
- GlueGlob (g, r2); /* duplicate blob */
- }
-
-